﻿using FinalPointSet.Model.Manager;
using FinalPointSet.Model.Model.FieldMapping;
using System.Collections.Generic;
using System.Linq;

namespace FinalPointSet.Model.Model.MockData
{
    public class MockFieldHelper
    {
        /// <summary>
        /// 将字段转换为模拟数据节点
        /// </summary>
        /// <param name="fields">字段</param>
        /// <returns>数据节点集合</returns>
        public static List<MockField> ToMockField(List<Field> fields)
        {
            List<MockField> mockNodes = [];
            for (int i = 0; i < fields.Count; i++)
            {
                MockField mockNode = new()
                {
                    Index = i + 1,
                    FieldName = fields[i].Name,
                    FieldComment = fields[i].Comment,
                    FieldType = fields[i].Type
                };
                mockNodes.Add(mockNode);
            }
            return mockNodes;
        }
    }
}